public class LeetCode1646 {

    public static void main(String[] args) {
        int n = 7;

        System.out.println(getMaximumGenerated(n));
    }

    static int N = 110;

    static int[] nums = new int[N];

    static {
        nums[0] = 0;
        nums[1] = 1;
        for (int i = 0; i < N; i++) {
            if (2 * i < N) {
                nums[2 * i] = nums[i];
            }
            if (2 * i + 1 < N) {
                nums[2 * i + 1] = nums[i] + nums[i + 1];
            }
        }
        for (int i = 0, max = 0; i < N; i++) {
            nums[i] = max = Math.max(max, nums[i]);
        }
    }

    public static int getMaximumGenerated(int n) {
        return nums[n];
    }
}
